package cn.tedu.demo03zl.controller;

import cn.tedu.demo03zl.entity.Exh;
import cn.tedu.demo03zl.mapper.ExhMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/exh/")
public class ExhController {
    @Autowired(required = false)
    ExhMapper mapper;

    @RequestMapping("selectAll")
    public List<Exh> select(){
        /*System.out.println(mapper.select());*/
        return mapper.select();
    }

    @RequestMapping("add")
    public void add(Exh exh){
        exh.setCreated(new Date());
        mapper.add(exh);
    }
}
